#!/bin/bash
set -e

source $(dirname $0)/version

cd $(dirname $0)/..

mkdir -p dist/artifacts
cp bin/harvester dist/artifacts/harvester${SUFFIX}

cd $(dirname $0)/package

IMAGE=${REPO}/harvester:${TAG}
DOCKERFILE=Dockerfile
if [ -e ${DOCKERFILE}.${ARCH} ]; then
    DOCKERFILE=${DOCKERFILE}.${ARCH}
fi

cp ../bin/harvester .

docker build --build-arg VERSION=${VERSION} -f ${DOCKERFILE} -t ${IMAGE} .
echo Built ${IMAGE}
